package queue.mine;

import java.util.LinkedList;

/**
 * @BelongsProject: leetcode
 * @BelongsPackage: queue
 * @Author: Administrator
 * @CreateTime: 2018-12-09 12:03
 * @Description: leetcode 225 用队列实现栈
 */
public class QueueToStack {
    LinkedList<Integer> linkedList;
    public QueueToStack() {
        linkedList=new LinkedList<>();
    }

    /** Push element x onto stack. */
    public void push(int x) {
        linkedList.push(x);
    }

    /** Removes the element on top of the stack and returns that element. */
    public int pop() {
        return linkedList.removeFirst();
    }

    /** Get the top element. */
    public int top() {
        return linkedList.getFirst();
    }

    /** Returns whether the stack is empty. */
    public boolean empty() {
        return linkedList.isEmpty();
    }
}
